Skip to content

Remove top-level await from plugin#420

Merged
Boshen merged 16 commits intomainfrom
feat/better-internals
Feb 4, 2026
Merged

Remove top-level await from plugin#420
Boshen merged 16 commits intomainfrom
feat/better-internals

Conversation

@thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Dec 2, 2025

There are two large-ish issues with the current implementation of this plugin:

  1. Builtin and compatible third-party plugins are all loaded up front — requiring us to use top-level await — this also slows things down unnecessarily. We should be lazy loading plugins instead.
  2. All the transforms happen at the "parser" stage by replacing the parse method of builtin plugins and third party plugins to call the original and walk + mutate the AST. We should instead override the printer and perform the sorting then.

This PR addresses the first one and prepares for the 2nd one with a pretty extensive internal refactor.

It's likely that this PR, once done, can be released in the v0.7.x series. While no breaking changes are intended (or anticipated) moving sorting logic to the print stage that should probably be a v0.8.x since things will be quite different architecturally.

@thecrypticace thecrypticace changed the title Remove top-level await from plugin loading Remove top-level await from plugin Dec 2, 2025
@thecrypticace thecrypticace force-pushed the feat/better-internals branch 2 times, most recently from 97eefe0 to 57b6f6c Compare December 9, 2025 20:17
@thecrypticace thecrypticace marked this pull request as ready for review December 9, 2025 20:20
@Boshen Boshen force-pushed the feat/better-internals branch from 0fc721e to 0ad1b29 Compare February 2, 2026 06:09
@Boshen
Copy link
Collaborator

Boshen commented Feb 4, 2026

@Dunqing reviewed the code and confirmed this works with Prettier.

@Boshen Boshen merged commit c39497f into main Feb 4, 2026
1 check passed
@Boshen Boshen deleted the feat/better-internals branch February 4, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants